import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
  name: 'img'
})
export class ImgPipe implements PipeTransform {

  transform(width: number, height?: number): string {
    if (!height) {
      height = Math.round(width * (Math.sqrt(5) - 1) / 2);
    }
    return `http://via.placeholder.com/${width}x${height}`;
  }

}
